#ifndef MYGRAPH_H
#define MYGRAPH_H

#include <QWidget>
#include <QPixmap>
#include <QImage>
#include <QRect>
#include <QPainter>
#include <qrgb.h>
#include <qvector.h>
#include <QToolTip>
#include <QLabel>
#include <QMouseEvent>
#include <vector>



class MyWidget:public QWidget
{
	Q_OBJECT
public:
	MyWidget(QWidget *parent = 0);
	~MyWidget();

	void setImageData(QImage image_data);
	void setCurveFlag(bool cur_flag);
	void spectrumDistance(int x_start_pos, int x_end_pos);
	void wavelenghthDemarcate(int distance);
	int difraPeakPos();
	void peakSearch();
	int maxSearch();
	QVector<int> rectDataPlot();


protected:
	void paintEvent(QPaintEvent *event);
	void getRectData();
	void mousePressEvent(QMouseEvent*event);
	void mouseMoveEvent(QMouseEvent *event);
	void mouseReleaseEvent(QMouseEvent *event);

signals:
	void getText(QString text_string);
	void getPos(int pos);
	//void PeakPos(int pos);

private:
	QImage m_image_data;
	QVector<int> m_data;
	QRect  m_rect;
	bool flag_pixel_curve;
	int line_x_start, line_y_start, line_x_end, line_y_end;
	bool left_mouse_pressed;
	QString distance_string;
	QString text_string;
	int difra_peak_pos;

};
#endif